#include "Common.h"

CreatureAI::CreatureAI(Creature* pCreature) : m_pCreature(pCreature), primary_target(0)
{
}

void CreatureAI::UnitEnteredCombat(Unit* pUnit)
{
	if(!pUnit || !m_pCreature)
		return;
	if(!primary_target)
	{
		m_pCreature->SetUI64Value(UNIT_FIELD_TARGET, pUnit->GetGUID());
		primary_target = pUnit;
	}
	m_attacking.insert(pUnit);
}

void CreatureAI::UnitLeftCombat(Unit* pUnit)
{
	if(!m_pCreature)
		return;
	m_pCreature->SetUI64Value(UNIT_FIELD_TARGET, 0);
}